<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix" style="height: 32px">
        <el-row align="middle" type="flex">
          <el-col>
            <span>我的班级</span>
          </el-col>
        </el-row>
      </div>
      <div>
        <el-table
          :height="tableHeight"
          :max-height="tableHeight"
          :data="tableData"
          border
          style="width: 100%">
          <el-table-column
            align="center"
            prop="clazzId"
            label="班级">
          </el-table-column>
          <el-table-column
            align="center"
            prop="gradeName"
            label="年级">
          </el-table-column>
          <el-table-column
            align="center"
            prop="verName"
            label="适用版本">
            <template slot-scope="{ row }">
              <el-link type="primary" @click="verHandle(row)">{{ row['verName'] }}</el-link>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script>
import {CheckClazz} from '@/api/bt/student-eval/check/check-clazz'

export default {
  name: "CheckClazz",
  data() {
    return {
      //表格高度根据窗口
      tableHeight: window.innerHeight - 220,
      screenHeight: window.innerHeight,
      // 表格数据
      tableData: [],
    }
  },
  mounted() {
    const that = this
    window.onresize = () => {
      return (() => {
        window.screenHeight = window.innerHeight
        this.screenHeight = window.screenHeight;
      })()
    }
  },
  watch: {
    screenHeight(val) {
      this.screenHeight = val
      this.tableHeight = this.screenHeight - 220
    }
  },
  created() {
    this.GetMyClazz()
  },
  methods: {
    //获取页面 账户管理班级
    GetMyClazz() {
      CheckClazz().then((res) => {
        this.tableData = res.data
      })
    },
    verHandle(row) {
      this.$emit("ver-click", row)
    },
  },

}
</script>

<style scoped>
::v-deep.el-table--border {
  border-bottom: 1px solid #EBEEF5;
}
</style>
